<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Auth_model extends CI_Model {

	function __construct() {
		parent::__construct();
	}

	/**
	 * 관리자 정보
	 */
	function get_admin($user_id) {
		log_message('debug',"#### Auth_model::get_admin($user_id)");

		$query = $this->db->get_where('tb_admin',array('user_id'=>$user_id)) or $this->logsql->log_sql('error');
		$result = $query->row_array();
		
		$this->logsql->log_sql();
		$this->logsql->log_result($result);

		if (count($result) > 0) {
			return TRUE;
		}
		return FALSE;
	}
	
	/**
	 * 사용자 정보 가져오기]
	 * package_cd는 비회원이면 0, 회원이면 1로 세팅
	 */
	function get_member($user_id) {
		log_message('debug', "#### Auth_model::get_member($user_id)");
		
		$sql  = PHP_EOL." SELECT  ";
		$sql .= PHP_EOL."       M.* ";
		$sql .= PHP_EOL." FROM  tb_member M ";
		$sql .= PHP_EOL." WHERE M.use_yn = 'Y'  ";
		$sql .= PHP_EOL." AND   M.user_id = ? ";
		$query = $this->db->query($sql, array($user_id)) or $this->logsql->log_sql('error');
		$result = $query->row_array();
		
		$this->logsql->log_sql();
		$this->logsql->log_result($result);

		return $result;
	}

}

/* End of file auth_model.php */
/* Location: ./application/models/admin/auth_model.php */